import request from '@/config/axios'

// 展览 VO
export interface ExhibitionVO {
  id: number // 展览ID
  title: string // 展览标题
  joinSchool: string // 参与院校
  cooperationUnit: string // 合作单位
  cover: string // 封面
  type: number // 展览类型
  description: string // 展会介绍
  deleted: boolean // 是否删除
  userId: number // 发布者
  startTime: Date // 开始时间
  endTime: Date // 结束时间
  authorsMessage: string // 作者寄语
}

// 展览 API
export const ExhibitionApi = {
  // 查询展览分页
  getExhibitionPage: async (params: any) => {
    return await request.get({ url: `/td/exhibition/page`, params })
  },

  // 查询展览详情
  getExhibition: async (id: number) => {
    return await request.get({ url: `/td/exhibition/get?id=` + id })
  },

  // 新增展览
  createExhibition: async (data: ExhibitionVO) => {
    return await request.post({ url: `/td/exhibition/create`, data })
  },

  // 修改展览
  updateExhibition: async (data: ExhibitionVO) => {
    return await request.put({ url: `/td/exhibition/update`, data })
  },

  // 删除展览
  deleteExhibition: async (id: number) => {
    return await request.delete({ url: `/td/exhibition/delete?id=` + id })
  },

  // 导出展览 Excel
  exportExhibition: async (params) => {
    return await request.download({ url: `/td/exhibition/export-excel`, params })
  },

  // 获取参与院校列表
  getJoinSchoolList: async () => {
    return await request.get({ url: `/td/exhibition/join-school/list` })
  },

  // 获取合作单位列表
  getCooperationUnitList: async () => {
    return await request.get({ url: `/td/exhibition/cooperation-unit/list` })
  },
}
